<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://meevle.com/web/tags/MeevleTag.tld" prefix="meevle" %>
<jsp:useBean id="setDelegate" class="com.meevle.business.SetDelegate"/>


<p><b>Profile</b></p>
<div class="intro">
<ul>
	<li>get the average rating of all your sets and slots;</li>
	<li>read what other people wrote about your contributions.</li>
</ul>
</div>
<p>Overview of the sets with the different slots and the average rating per slot</p>

	<c:choose>
		<c:when test='${sessionScope["userName"] != null}'>
			<p>Welcome <span class="bold">${sessionScope["userName"]}</span></p>
			
			<div id="userSets">
				<meevle:getUserSets object="${setDelegate}" username='${sessionScope["userName"]}'>
					<c:forEach var="set" items="${userSets}" varStatus="loop">
						<div class="set">
							<p><span class="bold">${set.name}</span> by <span class="bold">${set.owner.username}</span></p>
							<p id="setDescription${set.name}${set.owner.username}">Average rating of the set:<img src="http://chart.apis.google.com/chart?chs=100x50&chxt=x&chxl=0:|0|1|2|3|4|5&chxp=0,0,20,40,60,80,100&cht=bhs&chm=N*f2*,000000,0,-1,11&chd=t:${averageRatings[loop.index]}&chds=0,5" /></p>
							<div id="set${set.name}${set.owner.username}">
								<button class="submit" onclick="showSlots('${set.name}','${set.owner.username}','set${set.name}${set.owner.username}','${sessionScope["userName"]}')">Show Slots</button>
							</div>
						</div>
					</c:forEach>
				</meevle:getUserSets>
			</div>
		</c:when>
		<c:otherwise>
			<p>Please, login first before using this feature</p>
		</c:otherwise>
	</c:choose>